#add_definitions(-DLLVM_ENABLE_ABI_BREAKING_CHECKS=OFF)
#
## 链接 LLVM 核心库
## 确保使用动态链接
#set(LLVM_LINK_COMPONENTS
#        Core
#        Support
#        Passes
#)



#add_llvm_library(LLVMEncodeFunctionName2 MODULE EncodeFunctionName2.cpp)
add_llvm_library( LLVMEncodeFunctionName2 MODULE BUILDTREE_ONLY
  EncodeFunctionName2.cpp

  DEPENDS
  intrinsics_gen
  PLUGIN_TOOL
  opt
  )

# Find the libraries that correspond to the LLVM components
# that we wish to use
#llvm_map_components_to_libnames(llvm_libs support core irreader)

# Link against LLVM libraries
#target_link_libraries(LLVMEncodeFunctionName2 ${llvm_libs})

#target_link_libraries(LLVMEncodeFunctionName2
#        LLVMCore
#        LLVMSupport
#        LLVMAnalysis
#        LLVMBitReader
#        LLVMBitWriter
#        LLVMPasses
#)
# 链接必要的LLVM库
#llvm_map_components_to_libnames(llvm_libs
#        Core
#        Support
#        Analysis
#        Passes
#        TransformUtils
#        IRReader
#        BitReader
#        BitWriter
#)
#
#target_link_libraries(LLVMEncodeFunctionName2
#        ${llvm_libs}
#)

# 设置插件属性
#set_target_properties(LLVMEncodeFunctionName2 PROPERTIES
#        PREFIX ""
#        COMPILE_FLAGS "-fno-rtti"
#)


# 如果在 macOS 上开发，指定目标架构
if(APPLE)
    set(CMAKE_OSX_ARCHITECTURES arm64)
#    set_target_properties(LLVMEncodeFunctionName2 PROPERTIES
#        LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
endif()
